import { _decorator, Component, Enum } from "cc";
const { ccclass, property } = _decorator;

export enum RewardType {
  TwoShoot,
  Bomb,
}

@ccclass("UIReward")
export class UIReward extends Component {
  @property
  speed: number = 80;

  @property({
    type: Enum(RewardType),
    tooltip: "奖励类型",
  })
  rewardType: RewardType = RewardType.TwoShoot;

  start() {}

  update(deltaTime: number) {
    const pos = this.node.position;
    this.node.setPosition(pos.x, pos.y - this.speed * deltaTime);

    if (this.node.position.y < -200) {
      this.node.destroy();
    }
  }
}
